import { GameObject } from "./GameObject";

export class Player extends GameObject{
    constructor(info,gamemap){
        super();
        //起始点坐标
        this.cols = info.cols;
        this.rows = info.rows;
        this.gamemap = gamemap;
    }
    start(){

    }
    update(){
        this.render();
    }
    render(){
        //canvas (xc,yr)
        //画横线 (1,r) (this.cols-1,r)
        for(let r=1;r<this.rows;r++){
            this.ctx.beginPath();
            this.ctx.moveTo(1*this.L,r*this.L);
            this.ctx.lineTo((this.cols-1)*this.L, r*this.L);
            // ctx.closePath(); 如果想线条粗可以直接画一个封闭的相当于画两遍
            this.ctx.stroke();
        }
        //画竖线 (c,1) (c,this.this.rows-1)
        for(let c=1;c<this.cols;c++){
            this.ctx.beginPath();
            this.ctx.moveTo(c*this.L, 1*this.L);
            this.ctx.lineTo(c*this.L, (this.rows-1)*this.L);
            this.ctx.stroke();
        }
    }
}